package com.lsl.builder_pattern.example.example3.director;

import com.lsl.builder_pattern.example.example3.builder.ActorBuilder;
import com.lsl.builder_pattern.example.example3.product.Actor;

/**
 * description:游戏角色创建控制器：指挥者
 *
 * @author: liushengli
 * data: 2022/12/15
 */
public class ActorController {

    //逐步构建复杂产品对象
    public Actor construct(ActorBuilder ab) {

        Actor actor;

        ab.buildType();

        ab.buildSex();

        ab.buildFace();

        ab.buildCostume();

        //通过钩子方法来控制产品的构建
        if (!ab.isBareheaded()) {

            ab.buildHairstyle();

        }

        actor = ab.createActor();

        return actor;

    }
}

